#pragma once
#include "../event.h"
#include "tinyrpc/base/Fd.h"

namespace TinyRPC{
class EventLoop;
// AbstractChannel 控制了FdPtr, EventPtr 的生命周期
class AbstractChannel{
public:
    
    void setEventLoop(EventLoop * ownerLoop);
    void modifyEvent(EventLoop * ownerLoop);
    void deleteEvent(EventLoop * ownerLoop);
    void addEvent(EventLoop * ownerLoop);

    void updateEvent(int interestOp, const Task& task, EventLoop * ownerLoop);
    EventPtr getEventPtr(){return m_event;}
    
protected:
    AbstractChannel(int fd);
    virtual ~AbstractChannel();
    FdPtr m_fd;
    EventPtr m_event;
    // // 所属的EventLoop
    // EventLoop * m_ownerLoop;
};
}
